#ifndef GL_DATA_HPP
#define GL_DATA_HPP

#include "qt_api.hpp"
#include <QOpenGLFunctions_3_3_Core>

class GLData;

namespace gl
{
	void make_line_vert(GLfloat* vert, int idx, const Vec3d& start, const Vec3d& end);
	void box2_data(const Vec3d& pos_min, const Vec3d& dimen, GLData& data, const Rgb& color = { 1,1,1 });
	void cloud2_data(const PointCloud& cloud, GLData& data, const Rgb* def_color = nullptr);
}

class GLData {
public:
	enum Sort{
		CLOUD = 0,
		BOX,
	};
	GLData();
	GLData(const std::string key_,enum Sort sort_);
	~GLData();
	void clear();
	
	GLfloat* colors;
	GLfloat* vertices;
	
	GLenum mode;

	Vec3d pos_max;
	Vec3d pos_min;

	std::string key;

	int size_pos;
	int size_color;
	int len_pos;
	int len_color;
private:
	enum Sort sort;
};

#endif